<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">


        <ui:define name="title">
            <div class="tituloPagina">
                <h:graphicImage value="/LaCruz_v2/faces/javax.faces.resource/img/report-icon.png" />
                <h:outputText value="#{bundle.CreateColecaoTitle}" style="padding-left: 10px" ></h:outputText>
            </div>
        </ui:define>
        <ui:define name="body">
            <h:outputText value="#{colecaoController.clean}" />
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form id="formCadColecao" prependId="false">

                <h:outputScript name="js/jquery.maskedinput-1.2.1.js" target="head" rendered="true"/>
                <h:outputScript name="js/jquery-validate/jquery.validate.js" target="head" rendered="true" />

                <div class="msg_list">

                    <p class="msg_head" >

                        <h:graphicImage value="/LaCruz_v2/faces/javax.faces.resource/img/plus-icon.png" />
                    </p>
                    <div class="msg_body">
                        <h:panelGrid columns="2">

                            <h:outputLabel value="#{bundle.CreateColecaoLabel_descricao}" for="descricao" />
                            <h:inputText id="descricao" value="#{colecaoController.selected.descricao}" maxlength="40" title="#{bundle.CreateColecaoTitle_descricao}" />
                            <h:outputLabel value="#{bundle.CreateColecaoLabel_dataColecao}" for="dataColecao" />
                            <h:inputText id="dataColecao" maxlength="10" value="#{colecaoController.selected.dataColecao}" title="#{bundle.CreateColecaoTitle_dataColecao}" required="true" requiredMessage="#{bundle.CreateColecaoRequiredMessage_dataColecao}">
                                <f:convertDateTime pattern="dd/MM/yyyy" />
                            </h:inputText>
                        </h:panelGrid>
                        <br />
                        <div class="buttonStyle">
                            <h:commandLink action="#{colecaoController.create}" value="#{bundle.CreateColecaoSaveLink}" />
                        </div>
                        
                        <br />
                        <br />
                    </div>
                </div>
            </h:form>
            <script type="text/javascript" >
        $("input[name='dataColecao']").mask('99/99/9999');
            </script>
             <script type="text/javascript">

        //Validaçao de formulário
        $(document).ready(function(){
            //id do form
            jQuery('#formCadColecao').validate( {
                rules: {
                    dataColecao: {
                        dateBr: true
                    }

                },
                //mensagens, caso não bater com as regras
                messages: {

                    dataColecao: {
                        dateBr:"data inv&aacute;lida"
                    }

                 }
            });
        });

            </script>
        </ui:define>
        <ui:define name="detalhe">
            <ui:include src="List.xhtml" />
        </ui:define>
    </ui:composition>

</html>
